# Makefile for Digital Mars C++ Compiler
# http://www.rarlab.com
# http://www.digitalmars.com
#
# DEFINES: UNRAR RARDLL GUI SFX_MODULE SILENT

NAME = unrar
EXT = exe

CPP = dmc

LINK = link

# --------------
# Release Build
# --------------
DEFINES = -DNDEBUG -D_MSC_VER -DUNRAR
CPPFLAGS = -o+all -ff -Nc -g- -Ae
LNKFLAGS = /EXETYPE:NT /MACHINE:i386 /SUBSYSTEM:CONSOLE /NOLOGO /NODEBUG /NOCODEVIEW /PACKFUNCTIONS

# --------------
# Debug Build
# --------------
#DEFINES = -D_DEBUG -D_MSC_VER -DUNRAR
#CPPFLAGS = -o+none -Nc -S -gf -Ae
#LNKFLAGS = /EXETYPE:NT /MACHINE:i386 /SUBSYSTEM:CONSOLE /NOLOGO /DEBUG

OBJ = rar.obj strlist.obj strfn.obj pathfn.obj savepos.obj smallfn.o global.obj \
       	file.obj filefn.obj filcreat.obj archive.obj arcread.obj unicode.obj \
	system.obj isnt.obj crypt.obj crc.obj rawread.obj encname.obj \
	resource.obj match.obj timefn.obj rdwrfn.obj consio.obj options.obj \
	ulinks.obj errhnd.obj rarvm.obj rijndael.obj getbits.obj sha1.obj \
	extinfo.obj extract.obj volume.obj find.obj unpack.obj cmddata.obj \
	filestr.obj recvol.obj rs.obj scantree.obj \
	list.obj \
#	dll.obj \

LIB = kernel32.lib+user32.lib+advapi32.lib

#DEF = dll.def

link: $(OBJ)
	$(LINK) $(LNKFLAGS) $(OBJ), $(NAME).$(EXT), $(NAME).map, $(LIB), $(DEF)

.c.obj:
	$(CPP) $(CPPFLAGS) $(DEFINES) -c $< -o $@

.cpp.obj:
	$(CPP) $(CPPFLAGS) $(DEFINES) -c $< -o $@

clean:
	del $(OBJ)
	del $(NAME).$(EXT)
	del $(NAME).map
